﻿	

#region Using Directives
using System;
using System.ComponentModel;
using System.Collections;
using System.Xml.Serialization;
using System.Data;
using NetROS.Tiers.Data.Bases;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Entities.Validation;

using NetROS.Tiers.Data;
using Microsoft.Practices.EnterpriseLibrary.Logging;

#endregion

namespace NetROS.Tiers.Services
{		
	
	///<summary>
	/// An component type implementation of the 'tblIzvadak' table.
	///</summary>
	/// <remarks>
	/// All custom implementations should be done here.
	/// </remarks>
	[CLSCompliant(true)]
	public partial class IzvadakService : NetROS.Tiers.Services.IzvadakServiceBase
	{
		/// <summary>
		/// Initializes a new instance of the IzvadakService class.
		/// </summary>
		public IzvadakService() : base()
		{
		}
        ///<summary>
        ///</summary>
        ///<param name="IDs"></param>
        ///<returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public virtual PretvoreneStavkeIzvatkaList GetStavkeBytblIzvodIDs(String IDs)
        {
            int totalCount = -1;
            return GetStavkeBytblIzvodIDs(IDs, 0,10000 , out totalCount);
        }
        ///<summary>
        ///</summary>
        ///<param name="IDs"></param>
        ///<param name="start"></param>
        ///<param name="pageLength"></param>
        ///<param name="totalCount"></param>
        ///<returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public virtual PretvoreneStavkeIzvatkaList GetStavkeBytblIzvodIDs(String IDs, int start, int pageLength, out int totalCount)
        {
            // throws security exception if not authorized
            SecurityContext.IsAuthorized("GetByIDKnjizenje");

            // get this data
            PretvoreneStavkeIzvatkaList list = null;
            totalCount = -1;
            TransactionManager transactionManager = null;

            try
            {
                //since this is a read operation, don't create a tran by default, only use tran if provided to us for custom isolation level
                transactionManager = ConnectionScope.ValidateOrCreateTransaction(false);
                NetTiersProvider dataProvider = ConnectionScope.Current.DataProvider;

                //Access repository
                list = dataProvider.IzvadakProvider.GetStavkeBytblIzvodIDs(transactionManager, IDs, start, pageLength, out totalCount);

                //intentionally leave transaction open on a read operation.

            }
            catch (Exception exc)
            {
                //if open, rollback, it's possible this is part of a larger commit
                if (transactionManager != null && transactionManager.IsOpen)
                    transactionManager.Rollback();

                //Handle exception based on policy
                if (DomainUtil.HandleException(exc, "NoneExceptionPolicy"))
                    throw;
            }
            return list;
        }
		
	}//End Class


} // end namespace
